<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('车辆配置')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="gray-bg">
<div class="ui-layout-west">
    <div class="box box-main">
<!--        <div class="box-header">-->
<!--            <div class="box-title">-->
<!--                <i class="fa icon-grid"></i> 车辆信息-->
<!--            </div>-->
<!--            &lt;!&ndash;            <div class="box-tools pull-right">&ndash;&gt;-->
<!--            &lt;!&ndash;                <a type="button" class="btn btn-box-tool" href="#" onclick="dept()" title="管理部门"><i class="fa fa-edit"></i></a>&ndash;&gt;-->
<!--            &lt;!&ndash;                <button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>&ndash;&gt;-->
<!--            &lt;!&ndash;                <button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>&ndash;&gt;-->
<!--            &lt;!&ndash;                <button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新部门"><i class="fa fa-refresh"></i></button>&ndash;&gt;-->
<!--            &lt;!&ndash;            </div>&ndash;&gt;-->
<!--        </div>-->
        <div class="ui-layout-content">
            <div id="tree" class="ztree"></div>
        </div>
    </div>
</div>

<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <!--            <div class="col-sm-12">-->
            <!--                <iframe th:src="@{/system/car}" name="iframe0" width="80%" height="100%" frameborder="0" seamless/>-->
            <iframe class="RuoYi_iframe" id="iframeCar" name="iframeCar" width="100%" height="100%"
                    th:data-id="@{/system/car/edit/{carId}(carId=${param.carId})}"
                    th:src="@{/system/car/edit/{carId}(carId=${param.carId})}" frameborder="0" seamless></iframe>
            <!--            </div>-->
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<script th:inline="javascript">
    var prefix = ctx + "system/car";
    let carId = [[${param.carId}]];
    $(function () {
        var panehHidden = false;
        if ($(this).width() < 769) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 300});
        // 回到顶部绑定
        if ($.fn.toTop !== undefined) {
            var opt = {
                win: $('.ui-layout-center'),
                doc: $('.ui-layout-center')
            };
            $('#scroll-up').toTop(opt);
        }
        queryDeptTree();
    });

    function queryDeptTree() {
        var url = ctx + "system/car/treeData";
        var options = {
            url: url,
            expandLevel: 2,
            onClick: zOnClick
        };
        $.tree.init(options);

        function zOnClick(event, treeId, treeNode) {
            console.log(treeNode);
            let diyData = treeNode.diyData || {url: '', busType: '', type: '',menuId:null};
            if (diyData.type == 1) {
                let newVar = ctx + diyData.url + carId + '?_=' + Math.random();
                diyData.busType = diyData.busType || '';
                diyData.menuId = diyData.menuId || null;
                newVar += '&busType=' + diyData.busType;
                newVar += '&menuId=' + diyData.menuId;
                newVar += '&nav_title=' + treeNode.name;
                console.log(newVar);
                if (!diyData.busType) {
                    // $.modal.msgWarning('暂未实现');
                    // return;
                }
                // document.getElementById('iframeCar').src=newVar;
                $('#iframeCar').attr('src', newVar);
            }
            // document.getElementById('iframeCar').location.reload(true);
            // $("#deptId").val(treeNode.id);
            // $("#parentId").val(treeNode.pId);
        }
    }
</script>
</body>
</html>